<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@page import="org.springframework.security.core.context.SecurityContextHolder"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Client Profile</title>
<link rel="stylesheet" type="text/css" href="css/style-old.css" />
 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<script type="text/javascript">
	$(document).ready(function() {
	
		$.ajax({
			url : './mock/brokerpage',
			dataType: "json",
			contentType: 'application/json',			  
			success : function(jsonData) {
				for(var a in jsonData){
			
					for(var b in jsonData[a]){
				
						var name=jsonData[a]["fname"]+" "+jsonData[a]["mname"]+" "+jsonData[a]["lname"];
						document.getElementById("id").innerHTML = jsonData[a]["brokerId"];
						document.getElementById("cname").innerHTML =name;
						document.getElementById("mobile").innerHTML =jsonData[a]["mobile"];
						document.getElementById("id1").innerHTML = jsonData[a]["brokerId"];
						document.getElementById("cname1").innerHTML =name;
						document.getElementById("mobile1").innerHTML =jsonData[a]["mobile"];
						
					}
				}
			}
		});
		
	});
	var profitloss=0;
$(document).ready(function() { 
	 var m=0;
	var n=0;
	
	 $.get('./countProfitLoss',function(responseJson) {
	 for(var a in responseJson){
		 m=m+(Number(responseJson[a]["lot1"])*Number(responseJson[a]["price1"]));
		 n=n+(Number(responseJson[a]["lot1"])*Number(responseJson[a]["price2"]));
		 profitloss=m-n;
	 }
	 
		 document.getElementById("netp").innerHTML=profitloss;
	 
	 }); 
});

$(document).ready(function() {
		$.ajax({
			url : './mock/bank',
			dataType: "json",
			contentType: 'application/json',			  
			  
			success : function(jsonData) {
				for(var a in jsonData){
					document.getElementById("closeb").innerHTML = jsonData[a]["cashl"];
					document.getElementById("totm").innerHTML = jsonData[a]["marginl"];
					document.getElementById("depf").innerHTML =jsonData[a]["creditamt"];
					document.getElementById("utim").innerHTML = jsonData[a]["margin_u"];
					document.getElementById("withf").innerHTML =jsonData[a]["debitamt"];


					document.getElementById("balm").innerHTML = jsonData[a]["margin_b"];
			document.getElementById("tot").innerHTML =Number( jsonData[a]["cashl"])+profitloss;
												;
					
			}}
		});
		
	});
</script>

<script type="text/javascript">


function prof()
{
if (container1.style.display=="none") container1.style.display="block"; 
else container1.style.display="block";
}
</script>


<script>
function logout(){
alert("You are Logout SuccessFully");
}
</script>
</head>
<body>
<div id="main_container">

	<div class="header">
    <div class="logo"><a href="#"><img src="img/ncmx-logo1.png" alt="" title="" border="0" width="200" height="70"/></a></div>
    
    <div class="right_header" align="right" style="margin-right: 15px;">Welcome <sec:authentication property="principal.username" /></div>
    <div class="jclock"></div>
    </div>
    
    <div class="main_content">
    
                    <div class="menu">
                    <ul>
                    <li>LoginID :&nbsp;&nbsp;<label id="id">&nbsp; </label>&nbsp;/&nbsp;&nbsp;
                    <label id="cname"></label>&nbsp;&nbsp;/&nbsp;&nbsp;<label id="mobile"></label></li>
                    <li><!-- <a href="#"> -->Exchange :&nbsp;&nbsp;
                       <select style="height:15px;font-size:9px;"><option>NMCEX</option></select><!-- </a> -->
                  
                    </li>
                    <li><!-- <a href="#"> -->Login Type :&nbsp;&nbsp; Client
                    
                    </li>
                    <li><!-- <a href="#"> -->Segment : &nbsp;&nbsp;
                    <select style="height:16px;font-size:9px;"><option>commodity mkt(13-14)</option></select>
                   <!--  </a> -->
                       
                    </li>
                  
                    </ul>
                    </div> 
                    
                    
               
    <div class="center_content"> 
    
    <div id="container1" class="right_content" >            
<div style="background:#FFFFCC;border-style:groove; border-width:1px;">
<label style=" width:100%;" >Client Fund View</label>
<label style="margin-right:5px; float:right;" onclick="history.go(-1);return true;">X</label>
</div><br/>
  <table width="100%" border="1" cellpadding="0" cellspacing="0" style="font-family:helvetica;">
  <tr ><td align="center" colspan="2">
  <b>Client Details:</b><label id="id1">&nbsp;&nbsp; </label>&nbsp;&nbsp;/&nbsp;&nbsp;
                    <label id="cname1"></label>&nbsp;&nbsp;/&nbsp;&nbsp;<label id="mobile1"></label></td></tr>    
 <tr>
 <td align="center"><b>CASH FUND</b></td> 
 <td align="center"><b>MARGINE FUND</b></td>
 </tr>
  <tr>
 <td align="center"></td> 
 <td align="center"></td>
 </tr>	
   <tr>
 <td align="center"></td> 
 <td align="center"></td>
 </tr>	
 <tr>
 <td align="center" > Closing Balance : <label id="closeb"></label></td>

 <td align="center">Total Margine : <label id="totm"></label></td>
 
 </tr>
 <tr>
  <td align="center">Deposite Fund : <label id="depf"></label></td>

  <td align="center"> Utilized Margine : <label id="utim"></label></td>
 </tr>
  <tr>
  <td align="center">Withdrawal Fund : <label id="withf"></label></td>
<td align="center"> Balance Margine : <label id="balm"></label></td>
 
 </tr>
  <tr>
  <td align="center">Net Profit/Loss : <label id="netp"></label></td>
  <td align="center"></td>
 
 </tr>
  <tr>
  <td align="center">ToTal : <label id="tot"></label></td>
 <td align="center"> </td>
 
 </tr>
 </table></div>
        
  </div>  
   <div class="clear"></div>
    </div>     
    <div class="footer">    
    	<div class="left_footer">Copyright&copy; <a href="#######">All Right Reserved</a></div>
    	<div class="right_footer"><a href="##"><img src="" alt="" title="" border="0" /></a></div>    
    </div>
</div>		
</body>
</html>